package com.hp.bon.sgw.stdbss30.common;

import java.util.HashMap;
import java.util.Map;

import com.alipay.api.internal.util.StringUtils;

public class BizParam {

	private Map<String, Object> params = new HashMap<>();
	
	public void setParam(String key, Object value) {
		params.put(key, value);
	}
	
	public Object getParam(String key) {
		return params.get(key);
	}
	
	public String getParamString(String key) {
		return String.valueOf(params.get(key));
	}
	
	public Integer getParamInteger(String key) {
		String tempValue = String.valueOf(params.get(key));
		if(StringUtils.isEmpty(tempValue)) {
			return null;
		}
		return Integer.valueOf(tempValue);
	}
	
	public Long getParamLong(String key) {
		Object tempValue = params.get(key);
		if(tempValue instanceof Long) {
			return (Long)tempValue;
		}
		if(null == tempValue) {
			return null;
		}
		if(StringUtils.isEmpty(tempValue.toString())) {
			return null;
		}
		return Long.valueOf(tempValue.toString());
	}
	
}
